


#ifndef PF_PAINTERQT_H
#define PF_PAINTERQT_H

#include <QPainter>

#include "pf_painter.h"
#include "lx_Export.h"

/**
 * The Qt implementation of a painter. It can draw objects such as
 * lines or arcs in a widget. All coordinates are screen coordinates
 * and have nothing to do with the graphic view.
 */
class LX_EXPORT PF_PainterQt: public QPainter, public PF_Painter {

public:
    PF_PainterQt( QPaintDevice* pd);
    virtual ~PF_PainterQt();

	virtual void moveTo(int x, int y);
	virtual void lineTo(int x, int y);
    virtual void drawGridPoint(const PF_Vector& p);
    virtual void drawPoint(const PF_Vector& p);
    virtual void drawLine(const PF_Vector& p1, const PF_Vector& p2);
    //virtual void drawRect(const PF_Vector& p1, const PF_Vector& p2);
	virtual void fillRect ( const QRectF & rectangle, const PF_Color & color );
	virtual void fillRect ( const QRectF & rectangle, const QBrush & brush );
    virtual void drawArc(const PF_Vector& cp, double radius,
                         double a1, double a2,
                         const PF_Vector& p1, const PF_Vector& p2,
                         bool reversed);
    
	virtual void drawArc(const PF_Vector& cp, double radius,
                         double a1, double a2,
                         bool reversed);
	virtual void drawArcMac(const PF_Vector& cp, double radius,
                         double a1, double a2,
                         bool reversed);
    virtual void drawCircle(const PF_Vector&, double radius);
    virtual void drawEllipse(const PF_Vector& cp,
                             double radius1, double radius2,
                             double angle,
                             double a1, double a2,
                             bool reversed);
        virtual void drawImg(QImage& img, const PF_Vector& pos,
			double angle, const PF_Vector& factor,
			int sx, int sy, int sw, int sh);
    virtual void drawTextH(int x1, int y1, int x2, int y2,
                           const QString& text);
    virtual void drawTextV(int x1, int y1, int x2, int y2,
                           const QString& text);

    virtual void fillRect(int x1, int y1, int w, int h,
                          const PF_Color& col);

    virtual void fillTriangle(const PF_Vector& p1,
                              const PF_Vector& p2,
                              const PF_Vector& p3);

    virtual void drawPolygon(const QPolygon& a);
	virtual void erase();
	virtual int getWidth();
	virtual int getHeight();

    virtual PF_Pen getPen();
    virtual void setPen(const PF_Pen& pen);
    virtual void setPen(const PF_Color& color);
    virtual void setPen(int r, int g, int b);
    virtual void disablePen();
    //virtual void setColor(const QColor& color);
    virtual void setBrush(const PF_Color& color);

    virtual void setClipRect(int x, int y, int w, int h);
    virtual void resetClipping();

protected:
	PF_Pen lpen;
	long rememberX; // Used for the moment because QPainter doesn't support moveTo anymore, thus we need to remember ourselve the moveTo positions
	long rememberY;
};

#endif

